package com.example.board.controller;

import com.example.board.common.R;
import com.example.board.service.PinCrownService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/api/")
@Api(tags = "销售，经销商排名",value = "销售，经销商排名")
@RequiredArgsConstructor
public class PinCrownController {

    private final PinCrownService pinCrownService;

    @ApiOperation("销冠排名看板")
    @PostMapping(value = "/champion-board/rank-salesman")
    public R getTopSaleStatic(){
        Map<String,Object> map = new HashMap<>();
        map.put("chartData", pinCrownService.getTopSaleStatic());
        return R.ok(map);
    }


    @ApiOperation("经销商 -  本周业绩排行")
    @PostMapping(value = "/champion-board/rank-distributor")
    public R getTopDistributorStatic(){
        Map<String,Object> map = new HashMap<>();
        map.put("chartData",  pinCrownService.getTopDistributorStatic());
        return R.ok(map);
    }


}
